<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <title>大厅</title>
    <link rel="stylesheet" type="text/css" media="screen" href="{$staticHost}/static/css/base.css?v=14" />
    <link rel="stylesheet" type="text/css" media="screen" href="{$staticHost}/static/css/mod.css?v=14" />
    <link rel="stylesheet" type="text/css" media="screen" href="{$staticHost}/static/css/run.css?v=131" />
    <script src="{$staticHost}/static/js/jquery.min.js"></script>
    <script src="{$staticHost}/static/js/moment.js"></script>
    <script src="{$staticHost}/static/js/mod.js"></script>
    <script src="{$staticHost}/static/js/js.js"></script>
</head>
<body>
{if $isTop==1}
  <section id="tipss" class="share-tips">
    想要得人气冠军？快快分享到朋友圈召集好友点赞吧！<br/>
    还可抽奖得到整套跑步装备哦！
    <img id="share-close" src="{$staticHost}/static/images/icon/close.png">
    <!-- <span class="san"></span> -->
  </section>
  {/if}
   <header id="lobby" class="pao-lobby pb10"></header><!-- 大厅头部 -->
   <div id="box" class="pr"></div><!-- 主要内容 -->
   <section id="box-discuss" class="discussion pb50" style="display: none;">
   <a class="db" style="margin-top:150px;" name="bottom" id="bottom"></a>
   </section>
  <nav class="homenav" style="z-index: 20">
    <a href="paomeHome"><i class="iconfont icon-zhuye"></i>首 页</a>
    <a href="paomeRank"><i class="iconfont icon-paihangbang"></i> 排行榜</a>
    <a class="on" href="paoLobby"><i class="iconfont icon-dating"></i>大 厅</a>
    <a href="meCenter">
       <i class="iconfont icon-wode">
           {if $msgNoReadNum>0}
            <sub id="nav-news">●</sub>
           {/if}
        </i>
        我的
    </a>
  </nav>
  <!-- 静态盒子 -->
  <script id="lobby-data" type="text/html">
    <h3 class="f19 bold ptb10 db">
     <%if(result.timeRang.currentRound!=4&&result.timeRang.currentRound){%>
      跑么杯第
      <%if(result.timeRang.currentRound==1){%>一<%}%>
      <%if(result.timeRang.currentRound==2){%>二<%}%>
      <%if(result.timeRang.currentRound==3){%>三<%}%>
      轮
    <%}else if(result.timeRang.currentRound==4){%>
      冠军争霸赛
    <%}else{%>
      冠军争霸赛已结束
    <%}%>
    </h3>
    
    <span class="f14 lh23">
    <%if(result.timeRang.currentRound==4&&result.timeRang.currentRound){%>
      <%=result.timeRang.start_time%>
      —
      <%=result.timeRang.end_time%>
    <%}else{%>
      感谢各位跑者的参与，我们下赛季再见！
    <%}%>
    </span><br/>
    <img src="/static/images/icon/ren.png">
    <span class="f11" >参与人数  <%=result.userCount%>人</span>　
    <img src="/static/images/icon/ren.png">
    <span class="f11" >讨论人数  <%=result.discussCount%>人</span>
  </script>
  <!-- title  -->
  <script id="data-box" type="text/html">
    <nav class="gray-nav f14 color_dakgray nav-position">
      <a id="dynamic" class="on">动态</a>
      <a id="discussion" href="#bottom">讨论区</a>
    </nav>
    <!-- 大厅导航 -->
    <section class="dynamic pb50" style="padding-top:150px">
      <ul class="line-gray-bottom plr10 lh32 f14">
        <li class="line-gray omit">
          
          <a class="color_dakgray" href="<%=result.advisoryInfo.topic_link%>">
          <%=result.advisoryInfo.topic%></a>
        </li>
        <li class="omit">
           <a class="color_dakgray" href="<%=result.advisoryInfo.advisory_link%>">
            官方资讯：
            <%=result.advisoryInfo.advisory%>
          </a>
        </li>
      </ul>
      <!-- 热门话题 官方咨询 -->
      <dl class="line-gray-bottom pao-notice pb10">
        <dt class="blue-line">跑么杯公告</dt>
        <dd class="p10">
          <img class="dib vm" src="/static/images/icon/laba.png">
          <a class="dib vm color_dakgray" href="noticeHall"> <%=content%></a>
        </dd>
      </dl>
      <!-- 跑么杯公告 -->
      <section class="spokesperson line-gray-bottom" >
        <h3 class="blue-line"><%=result.userTitle%></h3>
        <ul>
          <%for(var i=0; i<result.userRecommend.length;i++){%>
          <li class="user" data-id="<%=result.userRecommend[i].uid%>">
            <!-- <img src="<%=result.userRecommend[i].header%>"> -->
            <img src="<%if(result.userRecommend[i].header){%><%=result.userRecommend[i].header%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>"/>
            <%=result.userRecommend[i].nick_name%>
          </li>
         <%}%>
        </ul>
      </section>
    
    <!-- 跑么杯明星代言人 -->
      <dl class="line-gray-bottom elite-top">
        <dt class="blue-line">跑么杯精英榜TOP10</dt>
        <dd>
          <a href="hallOfFame">
            <i class="admire">
              <!-- <img src="<%=result.headers.energy%>"> -->
            
            <img class="topimg" src="<%if(result.headers.energy){%><%=result.headers.energy%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>"/>
            </i>
            土豪打赏榜
          </a>
          <a href="hallOfFame?tab=mileage">
            <i class="one">
              <!-- <img src="<%=result.headers.maxMileage%>"> -->
            <img class="topimg"  src="<%if(result.headers.maxMileage){%><%=result.headers.speed%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>"/>
            </i>
            配速榜
          </a>
          <a href="hallOfFame?tab=renqi">
            <i class="popularity">
              <!-- <img src="<%=result.headers.sentiment%>"> -->
            <img class="topimg"  src="<%if(result.headers.sentiment){%><%=result.headers.sentiment%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>"/>
            </i>
            最具人气跑者
          </a>
        </dd>
      </dl>
      <!-- 跑么杯精英榜TOP10 -->
      <%if(result.clubRecommend.length>0){%>
      <dl class="line-gray-bottom elite-top">
        <dt class="blue-line"><%=result.clubTitle%></dt>
        <dd>
          <a href="clubDetailNo?clubId=<%=result.clubRecommend[0].club_id%>">
            <i class="popularity-cs"><img src="<%=result.clubRecommend[0].header%>"></i>
            <%=result.clubRecommend[0].reason%>
            <span class="db"><%=result.clubRecommend[0].nick_name%></span>
          </a>
          <%if(result.clubRecommend.length>=2){%>
          <a href="clubDetailNo?clubId=<%=result.clubRecommend[1].club_id%>">
            <i class="lively"><img src="<%=result.clubRecommend[1].header%>"></i>
            <%=result.clubRecommend[1].reason%>
            <span class="db"><%=result.clubRecommend[1].nick_name%></span>
          </a>
          <%}%>
          <%if(result.clubRecommend.length>=3){%>
          <a href="clubDetailNo?clubId=<%=result.clubRecommend[2].club_id%>">
            <i class="mileage-cs"><img src="<%=result.clubRecommend[2].header%>"></i>
            <%=result.clubRecommend[2].reason%>
            <span class="db"><%=result.clubRecommend[2].nick_name%></span>
          </a>
          <%}%>
        </dd>
      </dl>
      <%}%>
      <!-- 跑么杯荣誉墙 -->
     </section> 
    <!-- 动态 -->
    
 </script>
 <script  id="discuss" type="text/html">
  <div class="topic-input">
    <input id="import" class="ac" type="text" placeholder="输入你想说的话" name="">
    <a class="send" href="#bottom">发送</a>
  </div>
  <%if(result.list){%>
   <ul class="discussion-list" reversed style="padding-top: 177px;"> 
      <%for(var q=0; q<result.list.length;q++){%>
      <li class="<%if(result.list[q].isSelf==0){%>other<%}%><%if(result.list[q].isSelf==1){%>oneself<%}%>">
        <img class="rounde16" src="<%=result.list[q].header%>" alt="">
        <p>
          <span class="name"><%=result.list[q].nickname%></span>
          <span class="time"><%=result.list[q].add_time%></span>
          <span class="text"><%=result.list[q].comment%></span>
        </p>
      </li>
      <%}%>
    </ul>
  <%}%>

</script>
<section id="mask-box" class="masklayer" style="display: ;"></section>
<script id="mask" type="text/html">
  <div class="pao-tier" style="top: 20%;width: 90%; left: 5%">
    <span class="pao-close"></span>
    <div class="user-datum">
      <img src="<%=result.member.header%>" alt="">
      <h4><%=result.member.nickname%></h4>
      <p class="imaginary">所属：<%=result.clubInfo.title%></p>
      <section class="no-znl">
         <ul class="user-datum-list">
          <li class="right-line">
            全员跑量
            <b>
              <%if(result.userData.mileag==0.00){%>--<%}%>
              <%if(result.userData.mileage>0){%>
                <%=result.userData.mileage%>km 
              <%}%>
            </b>
          </li>
          <li>
            全员跑量排名
            <b>
              <%=result.userData.rankInfo%>
            </b>
          </li>
        </ul>
        <ul class="user-datum-list imaginary">
          <li class="right-line">
            最远纪录
            <b>
              <%if(result.userData.max_mileage==0.00){%>--<%}%>
              <%if(result.userData.max_mileage>0){%>
                <%=result.userData.max_mileage%>km
              <%}%>
            </b>
          </li>
          <li class="right-line">
            获得点赞数
            <b>
              <%if(result.userData.agree_num==0){%>--<%}%>
              <%if(result.userData.agree_num>0){%>
                <%=result.userData.agree_num%>
              <%}%>
            </b>
          </li>
          <li>
            获得打赏人气
            <b>
              <%if(result.userData.energy_num==0){%>--<%}%>
              <%if(result.userData.energy_num>0){%>
               <%=result.userData.energy_num%>
              <%}%>
            </b>
          </li>
        </ul>
        <p>喜欢Ta就支持Ta，让Ta榜上有名</p>
        <div class="user-btn">
          <a id="like">为Ta点赞</a>
          <a class="ta" class="<%if(result.isLight==1){%>on<%}%>" >打赏人气</a>
        </div>
      </section>
      <section id="znl" style="display: none;">
       <!--  <h4>赋予正能量</h4>
        <p>喜欢Ta就支持Ta，让Ta榜上有名</p> -->
        <ul class="energy-list">
          <li>10</li>
          <li>15</li>
          <li class="on">20</li>
          <li>25</li>
          <li>30</li>
        </ul>
        <p>您的正能量当前剩余：<%=result.total_energy%></p>
        <div class="user-btn">
          <a class="gl" class="on" style="width:95%">鼓 励 一 下</a>
        </div>
      </section>
    </div>
  </div>
</script>
{if $isMasklayer==0}
<div id="fxtip" class="masklayer" style="display: block;">
    <img class="fr ml15" style="width:70%;" src="{$staticHost}/static/images/img/share@2x-min.png">
</div>
{/if}
<div id="tips"></div>
</body>
<script type="text/javascript">
  var wxUrl="{$staticHost}/paome_webIndex/paoShare";
  var content ="";
   $("#fxtip").click(function(){
      $("#fxtip").hide()
    })
  $(function(){
    $.get("{$staticHost}/paome_home/hallAffiche", {}, function(data, error) {
      data=JSON.parse(data);
     content = data.result.content;
     $.get("{$staticHost}/paome_hall/getHallData", {}, function(data, error) {
        data=JSON.parse(data);
        data.content = content;

        var html = template('data-box', data);
        document.getElementById('box').innerHTML = html;

        var o = document.getElementById("tipss");
        if(o){
          var boxHeight = o.offsetHeight  
          var e =boxHeight+97
          var p =boxHeight+60

          if(boxHeight!=0){
            $("#lobby").css("top",boxHeight)
            $("#box").css("padding-top",p)
            $(".gray-nav").css("top",e)
            $(".topic-input").css("top","205px")
            $("#tipss").css({"position":"fixed","top":"0","z-index":"100","width": "92%"})
            $(".dynamic").css("padding-top","80px")
            $(".discussion-list").css("padding-top","125px")
            console.log($(".gray-nav").html())
          }
          $("#share-close").click(function(){
            $(".share-tips").hide()
            $("#lobby").css('top','0')
            $(".topic-input").css("top","145px")
            $(".gray-nav").css("top","97px")
             $(".dynamic").css("padding-top","20px")
            $(".discussion-list").css("padding-top","177px")
            $.get('{$appHost}/paome_webIndex/closeTop');
          })
        }
        {template 'paome/run/share-box'}
        $("#dynamic").click(function(){
          $(".dynamic").show();
          $("#dynamic").addClass("on");
          $(".discussion").hide();
          $("#discussion").removeClass("on");

        })
         $("#discussion").click(function(){
          $(".discussion").show();
          $("#discussion").addClass("on");
          $(".dynamic").hide();
          $("#dynamic").removeClass("on");
        })

        
         $(".user").click(function(){
          var uidD = "{$uid}";
          if(!uidD){
            $("#tips").show();
            $("#tips").html("亲，登陆后才能操作哦")
            Timeout();
            return;
          }
          var target_uid = $(this).attr('data-id')
          var uid =target_uid;
           $.get("{$staticHost}/paome_hall/getUserPaome", {'target_uid':target_uid}, function(data, error) {
            var data=JSON.parse(data);
            var userName = data.result.member.nickname;
          $(".masklayer").hide();
              if(data.result == undefined || data.result.userData == undefined || !data.result.userData){
                $(".masklayer").hide();
                return;
              }
              var html = template('mask', data);
              document.getElementById('mask-box').innerHTML = html;
              var uidD = "{$uid}";
              if(uidD.length>0){
              if(uid==uidD){
                $(".user-btn").hide();
              }
              }
              $(".pao-close").click(function(){
                $(".masklayer").hide();
              })
              $("#like").click(function(){
                 $.get("{$staticHost}/paome_hall/paomeThumbUp", {'target_uid':uid}, function(data) {
                  data=JSON.parse(data);
                  if(data.error != undefined) {
                    $("#tips").show();
                    $("#tips").html(data.error.text);
                    Timeout()
                  } else {
                    var light = data.result.light * 1;
                    if(light > 0){
                      $("#like").html("已点赞喽");
                      $("#like").unbind();
                      $("#tips").show();
                      $("#tips").html("已打赏"+light+"赞");
                      Timeout()
                    }
                  }
                 })
              })
              if(data.result.isLight==1){
                $(".ta").addClass('on');
                $("#like").html("已点赞喽")
                $("#like").unbind();
              }
              if(data.result.isSupport==1){
                $(".ta").html("已打赏喽")
                $(".ta").unbind();
              }else{
                  $(".ta").click(function(){
                  $(".no-znl").hide();
                  $("#znl").show();
                })
              }
             
              
              $(".energy-list li").click(function(){
                  $(".energy-list li").removeClass('on')
                  $(this).addClass('on');
              })
              
              $(".gl").click(function(){
                var energyNum = $(".energy-list .on").text();
                var energyNum = energyNum*1
                var energy = (data.result.total_energy)*1
                if(energyNum>energy){
                  $(".gl").unbind();
                  $("#tips").show();
                  $("#tips").html("亲，您的当前正能量不足，快去赚取吧")
                  Timeout();
                  
                  return
                }
                $.get("{$staticHost}/paome_hall/reward", {'target_uid':uid,'energy':energyNum}, function(data,error) {
                  data=JSON.parse(data);
                    if(typeof data.result != 'undefined' && typeof data.result.isInsert!= 'undefined' &&data.result.isInsert!=0){
                      $(".gl").html("已打赏咯")
                      $("#tips").show();
                      $("#tips").html("土豪，您已经为 "+userName+" 打赏 "+energyNum+" 个人气");
                       Timeout()
                      $("#mask-box").hide();
                    }else{
                      $("#tips").show();
                      $("#tips").html(data.error.text);
                      Timeout()
                    }
                })
              })
            // 获取信息
            $(".masklayer").show();
           })
        })
      })
    })
    // 公告
    $.get("{$staticHost}/paome_hall/hallStatus", {}, function(data, error) {
     data=JSON.parse(data);
      var html = template('lobby-data', data);
      document.getElementById('lobby').innerHTML = html;

    })
 

      $("#dynamic").click(function(){
        $(".dynamic").show();
        $("#dynamic").addClass("on");
        $(".discussion").hide();
        $("#discussion").removeClass("on");

      })
       $("#discussion").click(function(){
        $(".discussion").show();
        $("#discussion").addClass("on");
        $(".dynamic").hide();
        $("#dynamic").removeClass("on");
      })
    })
    // 讨论区列表开始
    
    // 发表接口
    $.get("{$staticHost}/paome_hall/paomeComment", {}, function(data, error) {
      data=JSON.parse(data);
       var html = template('discuss', data);
      $('#box-discuss').prepend(html);
      $("input").focus(function(){
        $(".send").addClass("on")
        $("body").css("overflow","hidden")
      }) 
      $(".send").click(function(){
          var contentTTopic = $('#import').val();
          if(contentTTopic) {
              $.post('{$staticHost}/paome_hall/addComment', {'comment':contentTTopic}, function(data){
                  data = JSON.parse(data);
                  if(data.error != undefined) {
                      alert(data.error.text);
                  } else {
                    var contetxt ="<li class='oneself'><img class='rounde16' src='"+data.result.backInfo.header+"'><p style='border:none'><span class='name'>"+data.result.backInfo.nickname+"</span><span class='time'>"+data.result.backInfo.add_time+"</span><span class='text'>"+contentTTopic+"</span></p></li>"
                      $(".discussion-list").append(contetxt);
                  }
              })
          }
          $('#import').val("");
          $("body").css("overflow","scroll")
          return;
   
      })
    })
    // 讨论区列表结
   

    function Timeout(){
      // screenHeight = document.body.scrollHeight
      // var ee=screenHeight/2;
      $("body").css("overflow","hidden")
      // $("#tips").css("top",ee+"px")
      setTimeout(function(){ 
       $("#tips").hide();
       $("body").css("overflow","auto")
      }, 2000);
    }
 
   
</script>

</html>
